FROM golang:1.13-alpine as builder
RUN apk --no-cache add make git gcc libtool musl-dev
WORKDIR /
COPY . /
ENV GOPROXY https://goproxy.cn
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -i -o dev1 ./apigateway/dev.go

FROM alpine:latest

RUN apk add ca-certificates && \
    rm -rf /var/cache/apk/* /tmp/* && \
    [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf

COPY --from=builder /dev1 .
ENTRYPOINT ["/dev1"]
